package main

import (
	"github.com/goravel/framework/contracts/queue"
	"github.com/goravel/framework/facades"

	"goravel/bootstrap"
)

func main() {
	// This bootstraps the framework and gets it ready for use.
	bootstrap.Boot()

	// 启动计划任务
	// go facades.Schedule().Run()

	// 启动队列服务器
	go func() {
		if err := facades.Queue().Worker(&queue.Args{
			Connection: "redis",      // 队列链接
			Queue:      "processing", // 队列名称
			Concurrent: 1,            // 并发数
		}).Run(); err != nil {
			facades.Log().Errorf("队列运行错误: %v", err)
		}
	}()

	// Start http server by facades.Route().
	go func() {
		if err := facades.Route().Run(); err != nil {
			facades.Log().Errorf("路由运行错误: %v", err)
		}
	}()

	select {}
}
